package leetcode100;

import java.util.Scanner;

/**
 * @author shkstart
 * @create 2022-11-20-23:06
 */
public class Meme2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        int i = 0;
        int count = 0;
        while (i < n) {
            if (arr[i] < arr[i + 1]) {
                //这里属于递增，也就是非递减
                while (i < n && arr[i] <= arr[i + 1]) {
                    i++;
                }
                count++;
                i++;
            } else if (arr[i] == arr[i + 1]) {
                i++;
            } else {
                //这里属于递减，也就是非递增
                while (i < n && arr[i] > arr[i + 1]) {
                    i++;
                }
                count++;
                i++;

            }
        }
    System.out.println(count);

    }
}
